<!DOCTYPE html>
<html>
  
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  <meta name="author" content="Amos Zhu">
  
  
  <title>Kafka架构探险（一）——Kafka的集群安装 | Amos的技术博客</title>

  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  
    <meta name="keywords" content="kafka,centos7,kafka,">
  

  
  <meta name="description" content="工欲善其事必先利其器，我们想了解Kafka的话，必须先搭建Kafka的运行环境，启动Kafka">

  

  
    <script src="//cdn.jsdelivr.net/npm/leancloud-storage@3.11.1/dist/av-min.js" async></script>
  

  
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async></script>
  

  
    <script src="//unpkg.com/valine/dist/Valine.min.js" async></script>
  

  

  <script>
  // theme-ad's config script
  // it can be used in every script
  
  window.AD_CONFIG = {
    leancloud: {"appid":"eObxCkTJ6j4GzRxGLgiHyfJa-gzGzoHsz","appkey":"fzRMAFC6MCE11mp7mnvh4Kwe","comment":true,"count":true},
    welcome: {"enable":true,"interval":30},
    start_time: "2019-05-28",
    passwords: ["efe07af7441da2b69c4a41e42e73be4db47f66010a56900788a458354a7373ec", ],
    is_post: true,
    lock: false,
    author: "Amos Zhu",
    share: {"qq":true,"wechat":true},
    mathjax: true,
    page_type: "",
    root: "/blog/"
  };
</script>

  <script src="/blog/vendor/sha256.min.js"></script>
<script src="/blog/js/auth.js"></script>
<script src="/blog/js/index.js"></script>
<script src="/blog/vendor/qrcode.min.js"></script>

  
    <link rel="icon" href="/blog/images/favicon.ico">
    <link rel="apple-touch-icon" href="/blog/images/touch-icon.png">
  

  <link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

  <link rel="stylesheet" href="/blog/css/index.css">
<link rel="stylesheet" href="/blog/styles/components/highlight/highlight.css">

  
</head>
  <body>
    <header class="site-header">
  <div class="site-header-brand">
    
      <span class="site-header-brand-title">
        <a href="/blog/">Amos Zhu</a>
      </span>
    
    
      <span class="site-header-brand-motto"> | 当浮躁的心静不下，不妨写些东西或者看会书</span>
    
  </div>
  <div class="site-header-right">
    <nav class="site-header-navigation">
      
        <a href="/blog/" target="_self">首页</a>
      
        <a href="/blog/archives/" target="_self">归档</a>
      
        <a href="/blog/tags/" target="_self">标签</a>
      
        <a href="/blog/categories/" target="_self">分类</a>
      
        <a href="/blog/redis/" target="_self">redis</a>
      
        <a href="/blog/rabbitMQ/" target="_self">rabbitMQ</a>
      
        <a href="/blog/elasticsearch" target="_self">elasticsearch</a>
      
        <a href="/blog/stuff" target="_self">stuff</a>
      
        <a href="/blog/kafka" target="_self">kafka</a>
      
        <a href="/blog/friends/" target="_self">友链</a>
      
        <a href="/blog/about/" target="_self">关于</a>
      
    </nav>
    <div class="site-header-btn">
      
        <a href="https://gitee.com/amos_zhu" target="_blank" id="site-github">
          <i class="fa fa-github-alt"></i>
        </a>
      
      <a href="javascript:void(0);" id="site-search">
        <i class="fa fa-search"></i>
      </a>
      <a href="javascript:void(0);" id="site-nav-btn">
        <i class="fa fa-ellipsis-v"></i>
      </a>
    </div>
  </div>
</header>
<nav class="table-content" id="site-nav">
  <div class="table-content-title">
    <span>导航</span>
  </div>
  <div class="table-content-main">
    <ol class="toc">
      
        <li class="toc-item">
          <a href="/blog/" target="_self">
            首页
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/archives/" target="_self">
            归档
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/tags/" target="_self">
            标签
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/categories/" target="_self">
            分类
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/redis/" target="_self">
            redis
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/rabbitMQ/" target="_self">
            rabbitMQ
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/elasticsearch" target="_self">
            elasticsearch
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/stuff" target="_self">
            stuff
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/kafka" target="_self">
            kafka
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/friends/" target="_self">
            友链
          </a>
        </li>
      
        <li class="toc-item">
          <a href="/blog/about/" target="_self">
            关于
          </a>
        </li>
      
    </ol>
  </div>
</nav>
<div id="site-process"></div>
    <main>
      
  <div class="passage">
  <div class="passage-meta">
    <span>
      <i class="fa fa-calendar"></i>2019-09-17
    </span>
    
      <span>
        | <a href="/blog/categories/kafka/"><i class="fa fa-bookmark"></i>kafka</a>
      </span>
    
    
      <span>
        | <i class="fa fa-unlock-alt"></i>UNLOCK
      </span>
    
  </div>
  <h1 class="passage-title">
    Kafka架构探险（一）——Kafka的集群安装
  </h1>
  
  <article class="passage-article">
    <br>由于Kafka一般都是分布式集群来支持高并发和高可用的，所以我们这里也使用分布式集群的方法来搭建Kafka的运行环境<p></p>

<table>
<thead>
<tr>
<th>Ip:Port</th>
<th>Kafka Version</th>
<th>Kafka Port</th>
<th>Zookeeper Version</th>
<th>Zookeeper Port</th>
</tr>
</thead>
<tbody>
<tr>
<td>192.168.56.105</td>
<td>2.3.0</td>
<td>9092</td>
<td>3.5.5</td>
<td>2181</td>
<td></td>
</tr>
<tr>
<td>192.168.56.106</td>
<td>2.3.0</td>
<td>9092</td>
<td>3.5.5</td>
<td>2181</td>
<td></td>
</tr>
<tr>
<td>192.168.56.107</td>
<td>2.3.0</td>
<td>9092</td>
<td>3.5.5</td>
<td>2181</td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="Zookeeper集群环境搭建"><a href="#Zookeeper集群环境搭建" class="headerlink" title="Zookeeper集群环境搭建"></a>Zookeeper集群环境搭建</h3><p>Kafka依赖Zookeeper的环境，我们首先是需要安装zookeeper的集群环境，虽然Kafka内部有整合zookeeper的环境，但是我们还是来手动安装下zookeeper的集群环境，更好的理解Kafka和zookeeper的关系</p>
<p>按照我们上面规划好的ip和port来搭建zookeeper的运行环境，<br>Zookeeper是依赖Java环境的，这里安装Java环境的步骤省略。。。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 在usr/local下下载 zookeeper 的安装包</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span></span><br><span class="line"></span><br><span class="line"><span class="comment">## 下载 zookeeper 的安装包 记住下载 bin的安装包 否则启动的时候会缺少lib依赖</span></span><br><span class="line">wget http://mirror.bit.edu.cn/apache/zookeeper/stable/apache-zookeeper-3.5.5-bin.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment">## 解压</span></span><br><span class="line">tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz</span><br><span class="line">mv apache-zookeeper-3.5.5-bin apache-zookeeper-3.5.5</span><br><span class="line"></span><br><span class="line"><span class="comment">## 进入kafka目录下，新增配置文件,名称必须是zoo.cfg</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5/conf</span><br><span class="line">cp zoo_sample.cfg zoo.cfg</span><br><span class="line"></span><br><span class="line"><span class="comment">## 编辑配置文件</span></span><br><span class="line">vi zoo.cfg</span><br><span class="line">...</span><br><span class="line"><span class="comment">## 修改数据文件夹路径</span></span><br><span class="line">dataDir=/usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5/data</span><br><span class="line">dataLogDir=/usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5/logs</span><br><span class="line"><span class="comment">## 在文件末尾添加 server.x 其中的x 就是 myid 的值</span></span><br><span class="line">server.1=192.168.56.105:2888:3888</span><br><span class="line">server.2=192.168.56.106:2888:3888</span><br><span class="line">server.3=192.168.56.107:2888:3888</span><br><span class="line">...</span><br><span class="line"></span><br><span class="line"><span class="comment">## 创建data文件夹 logs文件夹</span></span><br><span class="line">mkdir /usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5/data</span><br><span class="line">mkdir /usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5/logs</span><br><span class="line"></span><br><span class="line"><span class="comment">## 创建myid</span></span><br><span class="line"><span class="built_in">cd</span> data</span><br><span class="line"><span class="built_in">echo</span> 1 &gt; myid</span><br><span class="line"></span><br><span class="line"><span class="comment">## 创建myid文件</span></span><br><span class="line"><span class="comment">## 编辑配置文件 profile 追加如下的配置</span></span><br><span class="line">vi /etc/profile</span><br><span class="line">...</span><br><span class="line">ZK_HOME=/usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5</span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$ZK_HOME</span>/bin:<span class="variable">$PATH</span></span><br><span class="line">...</span><br><span class="line"></span><br><span class="line"><span class="comment">## 配置文件文件生效</span></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure>
<p>这样我们就配置好了一台服务上的zookeeper的环境，基于同样的配置，我们来配置106和107上的配置，除了myid不一样，分别是2和3之外，其他的配置都是一样的。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 在105服务器上执行如下的命令</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span></span><br><span class="line"></span><br><span class="line"><span class="comment">## 将105上面的zookeeper复制到 106和107 上</span></span><br><span class="line">scp -r apache-zookeeper-3.5.5/ root@192.168.56.106:/usr/<span class="built_in">local</span>/</span><br><span class="line"></span><br><span class="line">scp -r apache-zookeeper-3.5.5/ root@192.168.56.107:/usr/<span class="built_in">local</span>/</span><br><span class="line"></span><br><span class="line"><span class="comment">## 进入到 zookeeper的data目录下 然后执行 echo x &gt; myid x在106上是2 在107上是3</span></span><br><span class="line"><span class="built_in">cd</span> /usr/apche-zookeeper-3.5.5/data</span><br><span class="line"><span class="built_in">echo</span> 2 &gt; myid</span><br><span class="line"></span><br><span class="line"><span class="comment">## 修改 /etc/profile 添加zookeeper的环境变量</span></span><br><span class="line">vi /etc/profile</span><br><span class="line">....</span><br><span class="line">ZK_HOME=/usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5</span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$ZK_HOME</span>/bin:<span class="variable">$PATH</span></span><br><span class="line">....</span><br><span class="line"></span><br><span class="line"><span class="comment">## 环境设置生效</span></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure>
<p>设置结束之后，每个节点启动zookeeper<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 启动zookeeper</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/apache-zookeeper-3.5.5</span><br><span class="line">./bin/zkServer.sh start</span><br><span class="line"></span><br><span class="line"><span class="comment">## 查看启动情况</span></span><br><span class="line">./bin/zkServer.sh status</span><br></pre></td></tr></table></figure></p>
<p><strong>所有的节点都需要启动，可以在所有的节点都启动完成之后查看每个节点的启动情况，看看leader和follower的情况</strong></p>
<h3 id="Kafka分布式集群环境搭建"><a href="#Kafka分布式集群环境搭建" class="headerlink" title="Kafka分布式集群环境搭建"></a>Kafka分布式集群环境搭建</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 下载 kafka</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span></span><br><span class="line">wget http://mirror.bit.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz </span><br><span class="line"></span><br><span class="line"><span class="comment">## 解压</span></span><br><span class="line">tar -xzf kafka_2.12-2.3.0.tgz</span><br><span class="line"><span class="comment">## 进入kafka目录下</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/kafka_2.12-2.3.0</span><br><span class="line"></span><br><span class="line"><span class="comment">## 编辑 环境变量配置</span></span><br><span class="line">vi /etc/profile</span><br><span class="line">...</span><br><span class="line">KAFKA_HOME=/usr/<span class="built_in">local</span>/kafka_2.12-2.3.0</span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$KAFKA_HOME</span>/bin:<span class="variable">$PATH</span></span><br><span class="line">...</span><br><span class="line"><span class="comment">## 环境变量设置生效</span></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br><span class="line"></span><br><span class="line"><span class="comment">## 编辑 config下的server.properties 修改如下的配置</span></span><br><span class="line">vi  config/server.properties</span><br><span class="line">...</span><br><span class="line">broker.id=1</span><br><span class="line">listeners=PLAINTEXT://192.168.56.105:9092</span><br><span class="line">zookeeper.connect=192.168.56.105:2181,192.168.56.106:2181,192.168.56.107:2181</span><br><span class="line">log.dirs=/usr/<span class="built_in">local</span>/kafka_2.12-2.3.0/logs</span><br><span class="line">...</span><br></pre></td></tr></table></figure>
<p>以上我们就配置好了kafka的参数，下面我们需要将kafka的安装包同步到其他的服务上，并且修改其中的参数</p>
<blockquote>
<p>broker.id=x  (x在192.168.56.106上是2 在192.168.56.107上是3)<br>listeners=PLAINTEXT://IP:9092 (IP是各个主机的ip地址)</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 将kafka的文件同步到106和107上</span></span><br><span class="line">scp -r /usr/<span class="built_in">local</span>/kafka_2.12-2.3.0 root@192.168.56.106:/usr/<span class="built_in">local</span>/</span><br><span class="line">scp -r /usr/<span class="built_in">local</span>/kafka_2.12-2.3.0 root@192.168.56.107:/usr/<span class="built_in">local</span>/</span><br><span class="line"></span><br><span class="line"><span class="comment">## 修改每个服务上的 broker.id=x 和 listeners</span></span><br><span class="line">broker.id=x (x 在106上为2 在107上为3)</span><br><span class="line">listeners=PLAINTEXT://IP:9092 (IP 为给个服务的ip)</span><br></pre></td></tr></table></figure>
<p>配置完成之后，启动各个服务节点<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 启动kafka服务</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/kafka_2.12-2.3.0</span><br><span class="line"></span><br><span class="line">./bin/kafka-server-start.sh -daemon config/server.properties</span><br></pre></td></tr></table></figure></p>
<p>创建topic<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 创建 topic</span></span><br><span class="line">./bin/kafka-topics.sh --create --zookeeper 192.168.56.105:2181 --replication-factor 3 --partitions 1 --topic <span class="built_in">test</span>-topic</span><br><span class="line"></span><br><span class="line"><span class="comment">## 查看指定topic的信息</span></span><br><span class="line">./bin/kafka-topics.sh --describe --zookeeper 192.168.56.105:2181 --topic <span class="built_in">test</span>-topic</span><br></pre></td></tr></table></figure></p>
<h3 id="单机版的Kafka环境搭建"><a href="#单机版的Kafka环境搭建" class="headerlink" title="单机版的Kafka环境搭建"></a>单机版的Kafka环境搭建</h3><p>我们先搭建好 Broker1上的环境<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 在usr/local下下载kafka的安装包</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span></span><br><span class="line"><span class="comment">## 下载 kafka的安装包</span></span><br><span class="line">wget http://mirror.bit.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz </span><br><span class="line"><span class="comment">## 解压</span></span><br><span class="line">tar -xzf kafka_2.12-2.3.0.tgz</span><br><span class="line"><span class="comment">## 进入kafka目录下</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/kafka_2.12-2.3.0</span><br></pre></td></tr></table></figure></p>
<p>kafka的运行时依赖zookeeper的，所以我们先要启动zookeeper才行，如果本机中没有安装zookeeper，可以使用kafka中打包好的zookeeper<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 在kafka的目录下启动zookeeper(默认端口是2181)</span></span><br><span class="line">bin/zookeeper-server-start.sh config/zookeeper.properties</span><br><span class="line"><span class="comment">## 启动kafka的服务，由于上述zookeeper不是后台启动，所以我们需要另开一个SSH渠道(默认端口9092)</span></span><br><span class="line">bin/kafka-server-start.sh config/server.properties &amp;</span><br></pre></td></tr></table></figure></p>
  </article>
  <aside class="table-content" id="site-toc">
  <div class="table-content-title">
    <i class="fa fa-arrow-right fa-lg" id="site-toc-hide-btn"></i>
    <span>目录</span>
  </div>
  <div class="table-content-main">
    <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#Zookeeper集群环境搭建"><span class="toc-text">Zookeeper集群环境搭建</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Kafka分布式集群环境搭建"><span class="toc-text">Kafka分布式集群环境搭建</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#单机版的Kafka环境搭建"><span class="toc-text">单机版的Kafka环境搭建</span></a></li></ol>
  </div>
</aside>
  
    <aside class="passage-copyright">
      <div>本文作者: Amos Zhu</div>
      
        <div>
          原文链接: 
          <a href target="_blank">http://amos_zhu.gitee.io/passages/Kafka架构探险（一）——Kafka的集群安装/</a>
        </div>
      
      <div>
        版权声明: 本博客所有文章除特别声明外, 均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议. 转载请注明出处!
      </div>
    </aside>
  
  
    <div class="passage-tags">
     
      <a href="/blog/tags/centos7/"><i class="fa fa-tags"></i>centos7</a>
     
      <a href="/blog/tags/kafka/"><i class="fa fa-tags"></i>kafka</a>
    
    </div>
  
</div>

    </main>
    
      
<div class="site-comment-contanier" data-plateform="leancloud">
  
    <p id="site-comment-info">
      <i class="fa fa-spinner fa-spin"></i> 评论加载中
    </p>
    <div id="site-comment"></div>
  
</div>
    
    <div class="site-footer-wrapper">
  <footer class="site-footer">
    
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">博客推荐</h5>
          
            <span class="site-footer-item">
              <a href="http://youzhixueyuan.com/series/java" target="_blank">优知学院</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://ruanyifeng.com/" target="_blank">阮一峰的个人网站</a>
            </span>
          
        </div>
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">系列教程</h5>
          
            <span class="site-footer-item">
              <a href="http://amos_zhu.gitee.io/blog/redis" target="_blank">Redis系列教程</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://amos_zhu.gitee.io/blog/rabbitMQ/" target="_blank">RabbitMQ教程</a>
            </span>
          
            <span class="site-footer-item">
              <a href="http://amos_zhu.gitee.io/blog/kafka/" target="_blank">Kafka架构探险</a>
            </span>
          
        </div>
      
        <div class="site-footer-col">
          <h5 class="site-footer-title">抓到我</h5>
          
            <span class="site-footer-item">
              <a href="https://gitee.com/amos_zhu" target="_blank">Gitee</a>
            </span>
          
            <span class="site-footer-item">
              <a href="https://blog.csdn.net/wdcl2468" target="_blank">CSDN</a>
            </span>
          
            <span class="site-footer-item">
              <a href="https://www.jianshu.com/u/2dbe61b1f3c3" target="_blank">简书</a>
            </span>
          
        </div>
      
    
    <div class="site-footer-info">
      <i class="fa fa-clock-o"></i> 本站已稳定运行<span id="site-time"></span>
    </div>
    
      <div class="site-footer-info">
        <i class="fa fa-paw"></i> 您是本站第 <span id="site-count"></span> 位访客
      </div>
    
    
      <div class="site-footer-info">
        <i class="fa fa-at"></i> Email: amoszhu@aliyun.com
      </div>
    
    <div class="site-footer-info">
      <i class="fa fa-copyright"></i> 
      2019 <a href="https://github.com/dongyuanxin/theme-ad/" target="_blank">Theme-AD</a>.
      Created by <a href="https://godbmw.com/" target="_blank">GodBMW</a>.
      All rights reserved.
    </div>
  </footer>
</div>
    <div id="site-layer" style="display:none;">
  <div class="site-layer-content">
    <div class="site-layer-header">
      <span class="site-layer-header-title" id="site-layer-title"></span>
      <i class="fa fa-close" id="site-layer-close"></i>
    </div>
    <div class="site-layer-body" id="site-layer-container">
      <div class="site-layer-input" id="site-layer-search" style="display: none;">
        <div class="site-layer-input-choose">
          <a href="javascript:void(0);" title="Change Search Engine">Google</a>
        </div>
        <input type="text">
        <i class="fa fa-search"></i>
      </div>
      
        <div class="site-layer-reward" id="site-layer-reward" style="display: none;">
          
            <div>
              <img src="/blog/images/wechat.png" alt="WeChat">
              
                <p>WeChat</p>
              
            </div>
          
            <div>
              <img src="/blog/images/alipay.png" alt="AliPay">
              
                <p>AliPay</p>
              
            </div>
          
        </div>
      
      <div id="site-layer-welcome" style="display:none;"></div>
    </div>
  </div>
</div>
    

<div class="bottom-bar">
  <div class="bottom-bar-left">
    <a href="/blog/passages/Java并发编程——AtomicReference-解决并发修改多个属性/" data-enable="true">
      <i class="fa fa-arrow-left"></i>
    </a>
    <a href="/blog/passages/SpringBoot-Redis-MemCache-Nginx-Lua实现三级缓存架构（四）——Nginx-Redis-Cache实现三级缓存架构/" data-enable="true">
      <i class="fa fa-arrow-right"></i>
    </a>
  </div>
  <div class="bottom-bar-right">
    <a href="javascript:void(0);" data-enable="true" id="site-toc-show-btn">
      <i class="fa fa-bars"></i>
    </a>
    
      <a href="#site-comment" data-enable="true">
        <i class="fa fa-commenting"></i>
      </a>
    
    <a href="javascript:void(0);" id="site-toggle-share-btn">
      <i class="fa fa-share-alt"></i>
    </a>
    
      <a href="javascript:void(0);" id="site-reward">
        <i class="fa fa-thumbs-up"></i>
      </a>
    
    <a href="javascript:void(0);" id="back-top-btn">
      <i class="fa fa-chevron-up"></i>
    </a>
  </div>
</div>
    <div id="share-btn">
  
  
  
  
    <a id="share-btn-qq" href="javascript:void(0);" target="_blank">
      <i class="fa fa-qq"></i>
    </a>
  
  
    <a id="share-btn-wechat" href="javascript:void(0);" target="_blank">
      <i class="fa fa-wechat"></i>
    </a>
  
</div>
    


  <script async>
  (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      if (curProtocol === 'https') {
          bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
      }
      else {
          bp.src = 'http://push.zhanzhang.baidu.com/push.js';
      }
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
  })();
  </script>



  <script async>
    (function(){
    var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?":"https://jspassport.ssl.qhimg.com/11.0.1.js?";
    document.write('<script src="' + src + '" id="sozz"><\/script>');
    })();
  </script>


    
  </body>
</html>